<template>
  <div class="container">
    <h2>{{ content.title }}</h2>
    <span>{{ formatDate(content.createTime) }}</span>
    <span>{{ content.username }}</span>
    <svg-icon icon-class="eye-open" />
    <div class="boxContainer" v-html="content.articleBody" />
  </div>
</template>

<script>
import moment from 'moment'
export default {
  props: {
    content: {
      type: Object,
      required: true
    }
  },
  methods: {
    formatDate(time) {
      moment.locale('zh-cn')
      return moment(time).format('YYYY-MM-DD  hh:mm:ss')
    }
  }
}
</script>

<style scoped lang='scss'>
.container {
  span{
    margin-right: 10px;
  }
::v-deep .boxContainer {
  padding: 16px;
  margin-top: 10px;
  background-color: #f5f5f5;
  img {
    width: 100%;
    height: auto;
  }
}
}
</style>
